package com.cxf.windex.entity;

import com.cxf.windex.enums.OrderTypeEnum;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.persistence.*;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;


@Table(name = "b_orders")
@Builder(toBuilder = true)
@AllArgsConstructor(access = AccessLevel.PACKAGE)
@NoArgsConstructor
@Getter
@Setter
public class BOrders {
    /**
     * 订单ID
     */
    @Id
    @ApiModelProperty(value = "订单ID")
    private String id;

    /**
     * 订单天数
     */
    @ApiModelProperty(value = "订单天数")
    private Long days;

    /**
     * 店铺ID
     */
    @ApiModelProperty(value = "店铺ID")
    @Column(name = "shop_id")
    private Long shopId;

    @ApiModelProperty(value = "商家openid")
    @Column(name = "shop_wxopenid")
    private String shopWxopenid;

    /**
     * 素材ID
     */
    @ApiModelProperty(value = "素材ID")
    @Column(name = "material_id")
    private String materialId;

    /**
     * 订单标题
     */
    @ApiModelProperty(value = "订单标题")
    private String title;

    /**
     * 订单文件
     */
    @ApiModelProperty(value = "文件访问路径")
    private String file;

    /**
     * 类型 0海报 1语音
     */
    @ApiModelProperty(value = "类型 0海报 1语音")
    private String type;

    /**
     * 状态  -1未支付 0未开始 1进行中  2已结束
     */
    @ApiModelProperty(value = "状态 0未发布 1进行中  2已结束  ")
    private String status;

    /**
     * 开始时间
     */
    @Column(name = "b_time")
    private Date bTime;

    /**
     * 结束时间
     */
    @Column(name = "e_time")
    private Date eTime;

    /**
     * 创建时间
     */
    @Column(name = "crt_time")
    private Date crtTime;

    /**
     * 创建用户IP
     */
    @Column(name = "crt_host")
    private String crtHost;

    /**
     * 更新时间
     */
    @Column(name = "upd_time")
    private Date updTime;

    /**
     * 更新用户IP
     */
    @Column(name = "upd_host")
    private String updHost;

    /**
     * 内容
     */
    @ApiModelProperty(value = "订单内容")
    private String content;

    @ApiModelProperty(value = "资源方IDS,逗号分隔")
    @Column(name = "resources_ids")
    private String resourcesIds;

    @ApiModelProperty(value = "总价")
    @Column(name = "total_price")
    private BigDecimal totalPrice;

    @ApiModelProperty(value = "已支付")
    @Column(name = "pay_price")
    private BigDecimal payPrice;

    @Transient
    private List<BResouces> resoucesList;

    @Transient
    private String statusDesc;

    public void setStatus(String status){
        this.status=status;
        switch (status){
            case "0":
                statusDesc="未开始";break;
            case "1":
                statusDesc="进行中";break;
            case "2":
                statusDesc="已完成";break;
             default:
                 break;
        }

    }


}
